﻿Imports Sunts.HyperV.Common

Public Class frmDatabaseSelector

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
        Using OpenFileDialog As New OpenFileDialog
            OpenFileDialog.ShowDialog()
            Me.txtDatabasePath.Text = OpenFileDialog.FileName
        End Using
    End Sub

    Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        If Not String.IsNullOrEmpty(Me.txtDatabasePath.Text) Then
            ChangeConnectionString("HyperVBackupManager.My.MySettings.ConnectionString", "Data Source=" & Me.txtDatabasePath.Text)
            My.Settings("ConnectionString") = "Data Source=" & Me.txtDatabasePath.Text
            Me.Close()
        End If
    End Sub
End Class